<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/tools/designer/src/lib/sdk/abstractwidgetbox.cpp -->
<head>
  <title>Qt 4.3: QDesignerWidgetBoxInterface Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QDesignerWidgetBoxInterface Class Reference<br /><sup><sup>[<a href="qtdesigner.html">QtDesigner</a> module]</sup></sup></h1>
<p>The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box. <a href="#details">More...</a></p>
<pre> #include &lt;QDesignerWidgetBoxInterface&gt;</pre><p>Inherits <a href="qwidget.html">QWidget</a>.</p>
<ul>
<li><a href="qdesignerwidgetboxinterface-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qdesignerwidgetboxinterface.html#QDesignerWidgetBoxInterface">QDesignerWidgetBoxInterface</a></b> ( QWidget * <i>parent</i> = 0, Qt::WindowFlags <i>flags</i> = 0 )</li>
<li><div class="fn"/>virtual <b><a href="qdesignerwidgetboxinterface.html#dtor.QDesignerWidgetBoxInterface">~QDesignerWidgetBoxInterface</a></b> ()</li>
<li><div class="fn"/>virtual QString <b><a href="qdesignerwidgetboxinterface.html#fileName">fileName</a></b> () const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignerwidgetboxinterface.html#load">load</a></b> () = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qdesignerwidgetboxinterface.html#save">save</a></b> () = 0</li>
<li><div class="fn"/>virtual void <b><a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a></b> ( const QString &amp; <i>fileName</i> ) = 0</li>
</ul>
<ul>
<li><div class="fn"/>201 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
<li><div class="fn"/>29 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
<li><div class="fn"/>12 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
</ul>
<h3>Additional Inherited Members</h3>
<ul>
<li><div class="fn"/>56 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
<li><div class="fn"/>19 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
<li><div class="fn"/>5 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
<li><div class="fn"/>38 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
<li><div class="fn"/>1 protected function inherited from <a href="qpaintdevice.html#protected-functions">QPaintDevice</a></li>
<li><div class="fn"/>1 protected slot inherited from <a href="qwidget.html#protected-slots">QWidget</a></li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QDesignerWidgetBoxInterface class allows you to control the contents of Qt Designer's widget box.</p>
<p>QDesignerWidgetBoxInterface contains a collection of functions that is typically used to manipulate the contents of <i>Qt Designer</i>'s widget box.</p>
<p><i>Qt Designer</i> uses an XML file to populate its widget box. The name of that file is one of the widget box's properties, and you can retrieve it using the <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() function.</p>
<p>QDesignerWidgetBoxInterface also provides the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function that saves the contents of the widget box in the file specified by the widget box's file name property. If you have made changes to the widget box, for example by dropping a widget into the widget box, without calling the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function, the original content can be restored by a simple invocation of the <a href="qdesignerwidgetboxinterface.html#load">load</a>() function:</p>
<pre> QDesignerWidgetBoxInterface *widgetBox = 0:
 widgetBox = formEditor-&gt;widgetBox();

 widgetBox-&gt;load();</pre>
<p>The QDesignerWidgetBoxInterface class is not intended to be instantiated directly. You can retrieve an interface to Qt Designer's widget box using the <a href="qdesignerformeditorinterface.html#widgetBox">QDesignerFormEditorInterface::widgetBox</a>() function. A pointer to <i>Qt Designer</i>'s current <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a> object (<tt>formEditor</tt> in the example above) is provided by the <a href="qdesignercustomwidgetinterface.html#initialize">QDesignerCustomWidgetInterface::initialize</a>() function's parameter. When implementing a custom widget plugin, you must subclass the <a href="qdesignercustomwidgetinterface.html">QDesignerCustomWidgetInterface</a> to expose your plugin to <i>Qt Designer</i>.</p>
<p>If you want to save your changes, and at the same time preserve the original contents, you can use the <a href="qdesignerwidgetboxinterface.html#save">save</a>() function combined with the <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>() function to save your changes into another file. Remember to store the name of the original file first:</p>
<pre> QString originalFile = widgetBox-&gt;fileName();

 widgetBox-&gt;setFileName(&quot;myWidgetBox.xml&quot;);
 widgetBox-&gt;save();</pre>
<p>Then you can restore the original contents of the widget box by resetting the file name to the original file and calling <a href="qdesignerwidgetboxinterface.html#load">load</a>():</p>
<pre> widgetBox-&gt;setFileName(originalFile);
 widgetBox-&gt;load();</pre>
<p>In a similar way, you can later use your customized XML file:</p>
<pre> if (widgetBox-&gt;filename() != &quot;myWidgetBox.xml&quot;) {
     widgetBox-&gt;setFileName(&quot;myWidgetBox.xml&quot;);
     widgetBox-&gt;load();
 }</pre>
<p>See also <a href="qdesignerformeditorinterface.html">QDesignerFormEditorInterface</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QDesignerWidgetBoxInterface"></a>QDesignerWidgetBoxInterface::QDesignerWidgetBoxInterface ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, <a href="qt.html#WindowType-enum">Qt::WindowFlags</a> <i>flags</i> = 0 )</h3>
<p>Constructs a widget box interface with the given <i>parent</i> and the specified window <i>flags</i>.</p>
<h3 class="fn"><a name="dtor.QDesignerWidgetBoxInterface"></a>QDesignerWidgetBoxInterface::~QDesignerWidgetBoxInterface ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the widget box interface.</p>
<h3 class="fn"><a name="fileName"></a><a href="qstring.html">QString</a> QDesignerWidgetBoxInterface::fileName () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Returns the name of the XML file <i>Qt Designer</i> is currently using to populate its widget box.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="load"></a>bool QDesignerWidgetBoxInterface::load ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Populates <i>Qt Designer</i>'s widget box by loading (or reloading) the currently specified XML file. Returns true if the file is successfully loaded; otherwise false.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="save"></a>bool QDesignerWidgetBoxInterface::save ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Saves the contents of <i>Qt Designer</i>'s widget box in the file specified by the <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() function. Returns true if the content is successfully saved; otherwise false.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() and <a href="qdesignerwidgetboxinterface.html#setFileName">setFileName</a>().</p>
<h3 class="fn"><a name="setFileName"></a>void QDesignerWidgetBoxInterface::setFileName ( const <a href="qstring.html">QString</a> &amp; <i>fileName</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Sets the XML file that <i>Qt Designer</i> will use to populate its widget box, to <i>fileName</i>. You must call <a href="qdesignerwidgetboxinterface.html#load">load</a>() to update the widget box with the new XML file.</p>
<p>See also <a href="qdesignerwidgetboxinterface.html#fileName">fileName</a>() and <a href="qdesignerwidgetboxinterface.html#load">load</a>().</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
